package d1208.Ljs2.Ljs10;

import java.lang.reflect.Field;

public class Demo1 {
    public static void main(String[] args) throws Exception{
        Class<?> c = Class.forName("Ljs2.Ljs10.Student");
        Student student = (Student)c.newInstance();
        Field field1 = c.getDeclaredField("name");
        field1.setAccessible(true);
        field1.set(student,"小虎");
        Field field2 = c.getDeclaredField("age");
        field2.setAccessible(true);
        field2.set(student,25);
        System.out.println(field1.get(student));
        System.out.println(field2.get(student));
    }
}
